Skip to content

test(templates): test py-shiny templates #1998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Jul 21, 2025
Merged

Conversation

karangattu
Copy link
Collaborator

@karangattu karangattu commented May 13, 2025

The most significant changes include adding support for the py-shiny-templates repository, enhancing Playwright test configurations, and introducing new tests for external templates.

Support for py-shiny-templates repository:

  • Added steps to checkout the py-shiny-templates repository and install its dependencies for Python versions 3.10 and above.
  • Introduced a new install-py-shiny-templates-deps target to install dependencies from the py-shiny-templates repository.

Enhancements to Playwright test configurations:

  • Added constants for timeout values (SHINY_INIT_TIMEOUT and ERROR_ELEMENT_TIMEOUT) and updated error handling to check for Shiny output errors, excluding known exceptions.

New tests for external templates:

  • Added a new test file to validate example apps from the py-shiny-templates repository. The test is skipped for Python 3.9 due to dependency constraints and runs only on Chromium browsers.

@karangattu karangattu marked this pull request as ready for review May 15, 2025 17:14
@karangattu karangattu requested a review from schloerke May 15, 2025 17:14
Deleted the unused 'Any' import from typing to clean up the code in tests/playwright/shiny/components/data_frame/edit/app.py.
Added two deprecation warning messages related to DatetimeIndex.format and Series.__getitem__ to the app_allow_external_errors list, as these are triggered by the cufflinks package.
Added conditional steps to skip installing py-shiny-templates dependencies and running example app tests for Python 3.9, due to scikit-learn 1.7.0+ requiring Python 3.10 or higher.
Added a pytest skipif marker to skip test_external_templates on Python 3.9, as the required scikit-learn version is only supported on Python 3.10 and above.
Comment on lines 269 to 270
error_locator = page.locator(".shiny-output-error")
expect(error_locator).to_have_count(0, timeout=ERROR_ELEMENT_TIMEOUT)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice that this will check all apps for any output errors. 🎉 !

Comment on lines -116 to -120
# langsmith (needed for langchain_core) versions >= 0.3
# (up to at least 0.3.2 as of 2025-01-29)
# cause an `argparse.ArgumentError` when running `pytest`.
# https://github.com/posit-dev/py-shiny/issues/1829
"langsmith<0.3",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related: #1829

@schloerke schloerke enabled auto-merge (squash) July 21, 2025 18:38
@schloerke schloerke merged commit 9b5a817 into main Jul 21, 2025
103 of 104 checks passed
@schloerke schloerke deleted the run-py-shiny-template-tests branch July 21, 2025 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants